﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="index" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Shopping.Common" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title> 点客商城-首页 </title>
    <link href="/css/base.css" rel="stylesheet" type="text/css" />
    <link href="/css/home.css" rel="stylesheet" type="text/css" />
    <link href="/css/tvad.css" rel="stylesheet" type="text/css" />
     <link href="/css/patch.css" rel="stylesheet" type="text/css" />
    <!--#include file="~/Public/commonjs.shtml" -->
    <script type="text/javascript" src="/JsBase/ADSlide.js"></script>
</head>
<body>
  
     <!--#include file="~/Public/top.shtml" -->
     <!--main开始-->
     
     <div class="main w960 cb pr">
       <!--#include file="/Public/onlineqq.shtml" -->
       <div class="block1 mt10">
         <!--left-->
         <div class="m_left">
           <h2>商品分类</h2>
           <%
               if (categories != null)
               {
                   bool isEnd = false;
                   for (int i = 0; i < 4 && i < categories.Count; ++i)
                   {
                       if ((i+1) >= 4 || (i+1) >= categories.Count) isEnd = true;
           %>

           <dl class="assort" <%=isEnd?"style=\"border:none;\"":"" %>>
             <dt><%=categories[i].FCategory.Name %></dt>
             <dd>
                <%
                    for (int j = 0; j < categories[i].SCategorys.Count; ++j)
                    {
                        if (j == 0 || (j + 1) % 2 > 0)
                        {
                           Response.Write("<p >");
                        }
                        else
                            Response.Write(" | ");
                        Response.Write("<a  href=\"" + bllUrl.GetGoodsListUrl(categories[i].FCategory.ID, categories[i].SCategorys[j].ID) + "\" >");
                        Response.Write(categories[i].SCategorys[j].Name);
                        Response.Write("</a>");

                       // if ((j+1) < categories[i].SCategorys.Count)
                         //   Response.Write(" | ");
                        
                       if ((j + 1) == categories[i].SCategorys.Count || (j + 1) % 2 == 0)
                            Response.Write("</p>");
                    }
                   %>
             </dd>
           </dl>
           <%}
               } %>
           
          
           <h1 class="mt10">热卖商品</h1>
           <div class="sales_number"><img src="/images/tu1.jpg" /></div>
         </div>
         <!--left end-->
         <!--right-->
         <div class="m_right ft">
            <div class="rotate">
              <div>
              

              <div id="idContainer2" class="ADcontainer">
                <table id="idSlider2" border="0" cellspacing="0" cellpadding="0">
                    <tbody>
                        <ul>
                        <!--#include file="~/AutoGenerate/index-tvad.htm" -->
                        </ul>
                    </tbody>
                </table>
                <ul id="idNum" class="num">
                </ul>
            </div>
            <script language="javascript">
                var forEach = function (array, callback, thisObject) {
                    if (array.forEach) {
                        array.forEach(callback, thisObject);
                    } else {
                        for (var i = 0, len = array.length; i < len; i++) { callback.call(thisObject, array[i], i, array); }
                    }
                }
                var st = new SlideTrans("idContainer2", "idSlider2", 5, { Vertical: false });
                var nums = [];
                //插入数字
                for (var i = 0, n = st._count - 1; i <= n; ) {
                    (nums[i] = $F("idNum").appendChild(document.createElement("li"))).innerHTML = ++i;
                }
                forEach(nums, function (o, i) {
                    o.onmouseover = function () { o.className = "on"; st.Auto = false; st.Run(i); }
                    o.onmouseout = function () { o.className = ""; st.Auto = true; st.Run(); }
                })
                //设置按钮样式
                st.onStart = function () {
                    forEach(nums, function (o, i) { o.className = st.Index == i ? "on" : ""; })
                }
                st.Run();
            </script>



              </div>
            
              
            </div>
            <!--#include file="~/AutoGenerate/hotgoods.htm" -->
         </div>
       </div>
         <!--right end-->
         <!--new product-->
         <div class="new_product">
           <div class="fl product_title">
             <img src="/images/tu4.jpg" />
           </div>
           <ul class="product_ul">
              <!--#include file="~/AutoGenerate/index-newgoods.htm" -->

           </ul>
                   </div>
         <!--new product end-->
         <!--六个块-->
         <!--休闲食品-->
         <div class="cb mt20">
           <div class="pink fl">
             <h1 class="pink_bg">
               <span>休闲食品</span>
               <p><a  href="/List/37-60-0.html" >膨化食品</a> | <a  href="/List/37-55-0.html" >饼干糕点</a> | <a  href="/List/37-56-0.html" >果脯蜜饯</a> | <a  href="/List/37-57-0.html" >肉干类</a></p>
             </h1>
             <div class="pink_main">
                <div class="fl"><img src="/images/tu6.jpg" /></div>
                <div class="fr">
                  <ul class="block_cont">
                        <!--#include file="~/AutoGenerate/index-xxsp-01.htm" -->
                  </ul>
                  <ul class="block_cont">
                        <!--#include file="~/AutoGenerate/index-xxsp-02.htm" -->        
                  </ul>
                
                </div>
             
             </div>
             <div class="pink_bottom"></div>
           </div>
             



            <div class="pink fr">
            <!--糖果&巧克力-->
             <h1 class="blue_bg">
               <span>糖果巧克力</span>
               <p><a href="/List/59-84-0.html">硬糖</a> | <a href="/List/59-85-0.html">软糖</a> | <a href="/List/59-88-0.html">口香糖</a> | <a href="/List/59-89-0.html">牛奶巧克力</a></p>
             
             </h1>
             <div class="pink_main">
                <div class="fl"><img src="/images/tu6a.jpg" /></div>
                <div class="fr">
                  <ul class="block_cont">
                     <!--#include file="~/AutoGenerate/index-tgqkl-01.htm" -->
                  </ul>
                  <ul class="block_cont">
                    <!--#include file="~/AutoGenerate/index-tgqkl-02.htm" -->               
                  </ul>
                
                </div>
             
             </div>
             <div class="pink_bottom"></div>
           </div>
           
            
            <div class="pink fl">
            <!--个人洗护-->
             <h1 class="orange_bg">
              <span>个人洗护</span>
               <p><a href="/List/47-121-0.html">口腔护理</a> | <a href="/List/47-126-0.html" >洗发护发</a> | <a href="/List/47-127-0.html">沐浴护理</a> | <a href="/List/47-132-0.html">香皂</a></p>
             </h1>
             <div class="pink_main">
                <div class="fl"><img src="/images/tu6b.jpg" /></div>
                <div class="fr">
                  <ul class="block_cont">
                    <!--#include file="~/AutoGenerate/index-grxh-01.htm" -->
                  </ul>
                  <ul class="block_cont">
                    <!--#include file="~/AutoGenerate/index-grxh-02.htm" -->            
                  </ul>
                
                </div>
             
             </div>
             <div class="pink_bottom"></div>
           </div>
           
           
            <div class="pink fr"> 
            <!--果汁饮料-->
             <h1 class="green_bg">
              <span>果汁饮料</span>
               <p><a  href="/List/42-147-0.html" >豆奶</a> | <a  href="/List/42-93-0.html" >果汁/蔬菜汁</a> | <a  href="/List/42-94-0.html" >茶饮料</a> | <a  href="/List/42-97-0.html" >咖啡饮料</a></p>
             </h1>
             <div class="pink_main">
                <div class="fl"><img src="/images/tu6c.jpg" /></div>
                <div class="fr">
                  <ul class="block_cont">
                    <!--#include file="~/AutoGenerate/index-gzyl-01.htm" -->
                  </ul>
                 <ul class="block_cont">
                   <!--#include file="~/AutoGenerate/index-gzyl-02.htm" -->              
                  </ul>
                
                </div>
             
             </div>
             <div class="pink_bottom"></div>
           </div>
           
            
            <%
                if (rushGoods != null && rushGoods.Rows.Count > 0)
                {
                    foreach (DataRow dr in rushGoods.Rows)
                    {
                      
                        string commendTitle = dr["CommendTitle"].ToString();
                        string goodsName = dr["GoodsName"].ToString();
                        int goodsID = int.Parse(dr["GoodsID"].ToString());
                        decimal marketPrice = decimal.Parse(dr["MarketPrice"].ToString());
                        decimal rushPrice = decimal.Parse(dr["RushPrice"].ToString());
                        int rushMaxQuantity = int.Parse(dr["RushMaxQuantity"].ToString());
                        int saleOutQuantity = int.Parse(dr["SaleOutQuantity"].ToString());
                        string commendImg = dr["CommendImg"].ToString();
                        string smallPictureUrl = dr["SmallPictureUrl"].ToString();
                        decimal discount = Math.Round(rushPrice / marketPrice, 2); 
                        
             %>
            <div class="pink fl">
            <!--抢购-->
             <h1 class="blank_bg"></h1>
             <div class="pink_main_buy">
               <div class="ad_pic">
                 <a href="/Goods/<%=goodsID %>.html" target="_blank" title="立刻抢购"><img src="<%=string.IsNullOrEmpty(commendImg)?smallPictureUrl:commendImg %>" /></a>
               </div>
               <h1 class="buy_title">
                 <a href="/Goods/<%=goodsID %>.html" target="_blank">
                   <%=(string.IsNullOrEmpty(commendTitle)? goodsName:commendTitle) %>
                 </a>
               </h1>
               <div class="buy">
                 <a class="fl" href="/Goods/<%=goodsID %>.html" target="_blank"><img src="/images/buy_bg.jpg" /></a>
                 <span class="fr">￥<%=Utility.FormatMoneyStr(rushPrice) %></span>
               </div>
               <div class="price cb pl10">
                 <p class="fl">限量<b class="orange f22"><%=rushMaxQuantity %></b> 份 &nbsp;还剩下<b class="orange f22"><%=rushMaxQuantity-saleOutQuantity %></b> 份</p>
                 <ul class="fr">
                   <li>市场价<br/><span class="line_th f18"><%=Utility.FormatMoneyStr(marketPrice) %>元</span></li>
                   <li>折扣<p><span class="orange f18"><%=discount %></span>折</p></li>
                   <li>为您节省<p><span class="orange f18"><%=Utility.FormatMoneyStr(marketPrice-rushPrice) %></span>元</p></li>
                 </ul>
               </div>
             </div>
             <div class="pink_bottom"></div>
           </div>
           
            <%}
                }%>
         

           
         </div>
       
         
         <!---块结束-->
        
         
     </div>
     <!--main结束-->
     <div class="share cb w960">
        <div>
           <!--#include file="~/AutoGenerate/AllPage-Bottom-Banner.htm" -->
        </div>
         <!--#include file="~/Public/bottom-shopHelper.shtml" -->
     </div>
    
     <!--#include file="~/Public/bottom.shtml" -->

</body>
</html>
